<template>
  <div class="center">
    <!-- 头部 -->
    <div class="header">
      <div class="user">
        <img src="../../assets/8.png" alt="" />
        <div class="name">
          <p>{{ $store.state.user.username }}</p>
          <p>普通用户</p>
        </div>
      </div>
      <div class="vip">
        <div class="pro">
          <p>Pro会员</p>
          <p>立即开通 ></p>
        </div>
      </div>
    </div>
    <!-- 我的资产 -->
    <div class="content">
      <p>我的资产</p>
      <van-divider />
      <div class="list">
        <van-row gutter="29">
          <van-col span="5">
            <div class="item">
              <p>￥0</p>
              <p>余额</p>
            </div></van-col
          >
          <van-col span="5">
            <div class="item">
              <p>￥0</p>
              <p>红包</p>
            </div></van-col
          >
          <van-col span="5">
            <div class="item">
              <p>￥0</p>
              <p>优惠券</p>
            </div></van-col
          >
          <van-col span="4">
            <div class="item">
              <p>￥0</p>
              <p>积分</p>
            </div></van-col
          >
          <van-col span="5">
            <div class="item">
              <p>￥0</p>
              <p>礼品卡</p>
            </div></van-col
          >
        </van-row>
      </div>
    </div>
    <div class="bg"></div>

    <!-- 列表 -->
    <van-grid class="itemList" :column-num="3">
      <van-grid-item class="item" icon="notes-o" text="我的订单" />
      <van-grid-item class="item" icon="friends-o" text="账号管理" />
      <van-grid-item class="item" icon="hotel-o" text="我的手机号" />
      <van-grid-item class="item" icon="calendar-o" text="周六一起拼" />
      <van-grid-item class="item" icon="cash-back-record" text="售后服务" />
      <van-grid-item class="item" icon="send-gift-o" text="邀请返利" />
      <van-grid-item class="item" icon="bag-o" text="优先购" />
      <van-grid-item class="item" icon="gold-coin-o" text="积分中心" />
      <van-grid-item class="item" icon="diamond-o" text="会员俱乐部" />
      <van-grid-item class="item" icon="location-o" text="地址管理" />
      <van-grid-item class="item" icon="passed" text="支付安全" />
      <van-grid-item class="item" icon="service-o" text="帮助与客服" />
      <van-grid-item class="item" icon="records" text="意见反馈" />
      <van-grid-item class="item" icon="new-arrival-o" text="我的竞拍" />
    </van-grid>

    <!-- 退出登录 -->
    <div class="logout">
      <button @click="handleLogOut">退出登录</button>
    </div>
    <div class="bg2"></div>
  </div>
</template>

<script>
import { Notify } from "vant";
import { Dialog } from "vant";
export default {
  name: "Center",
  methods: {
    async handleLogOut() {
      Dialog.confirm({
        message: "您确定要退出吗？",
      })
        .then(async (v) => {
          await this.$store.dispatch("logout");
          Notify({ type: "success", message: "退出成功" });
          this.$router.push("/home");
        })
        .catch((r) => {
          // console.log(r, 3);
        });
    },
  },
};
</script>

<style lang="less" scoped>
.center {
  width: 100%;
  // 头部
  .header {
    height: 150px;
    background: #fad286;
    padding-left: 20px;
    display: flex;
    .user {
      width: 60%;
      display: flex;
      font-size: 14px;
      color: #fff;
      padding-top: 30px;
      img {
        width: 63px;
        height: 63px;
        border-radius: 50%;
        margin-right: 10px;
      }
      .name {
        line-height: 10px;
        p {
          &:first-child {
            font-size: 18px;
          }
        }
      }
    }
    .vip {
      padding-top: 70px;
      width: 40%;
      .pro {
        height: 40px;
        background: #12161b;
        border-radius: 20px 0px 0px 20px;
        p {
          font-size: 13px;
          line-height: 2px;
          text-align: center;
          color: #f9e0c0;
          padding-top: 7px;
        }
      }
    }
  }

  // 内容区
  .content {
    padding: 0 10px;
    font-size: 13px;
    // line-height: 10px;
    .list {
      padding: 0 10px;
      .item {
        line-height: 10px;
      }
    }
  }

  //横线
  .bg {
    height: 10px;
    background: #eee;
    margin-top: 10px;
  }

  .logout {
    width: 100%;
    height: 80px;
    background-color: #eee;
    button {
      width: 100%;
      height: 50px;
      border: none;
      border-radius: 6px 6px 6px 6px;
      margin-top: 19px;
      font-size: 14px;
      background-color: white;
    }
  }
  .bg2 {
    height: 60px;
    background: #eee;
  }
}
</style>